import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";
import util from "@/utils/util";




/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: '序号',
    type: 'seq',
    fixed: 'left',
    width: '50',
    align: 'center',
  },
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '岗位',
    field: 'postRoleName',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '部门',
    field: 'postDeptName',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '实际分数',
    field: 'resultScore',
    align: 'center',
  },
  {
    width: 80,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];


export const vxeTableColumns2: VxeGridPropTypes.Columns = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '评价项目',
    field: 'groupName',
    showOverflow: 'title',
    align: 'center',
  },
  {
    title: '评价标准',
    field: 'evaluationStandard',
    showOverflow: 'title',
    align: 'center',
    formatter: ({ cellValue, row, column }) => {
      if (!cellValue) {
        return "";
      }
      return cellValue;
    },
  },
  {
    title: '个人信息',
    field: 'userInfo',
    align: 'center',
    formatter: ({ cellValue, row, column }) => {
      if (!cellValue) {
        return "";
      }
      return cellValue;
    },
  },

  {
    title: '评价分数',
    field: 'evaluationScore',
    align: 'center',
  },
  {
    title: '评分系数',
    field: 'rate',
    align: 'center',
  },
  {
    title: '实际分数',
    field: 'resultScore',
    align: 'center',
  },

];



export const vxeTableFormSchema: VxeFormItemProps[] = [
  {
    span: 5,
    field: 'keyword',
    title: '搜索',
    itemRender: {
      props: {
        placeholder: '名称/岗位',
      },
      name: 'VxeInput',
    },
  },
  {
    span: 5,
    field: 'year',
    title: '年份',
    itemRender: {
      props: {
        type:'year',
        // labelFormat:"yyyy",
        valueFormat:"yyyy-MM",
      },
      defaultValue:util.times("year")+"-01",
      name: 'VxeDatePicker',
    },
  },
  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];


export const formSchema: FormSchema[] = [

  {
    field: 'deptName',
    label: '部门',
    component:"Input",
    required: true,
  },
  {
    field: 'roleName',
    label: '岗位',
    component:"Input",
    required: true,
  },
  {
    field: 'education',
    label: '学历要求',
    component:"Input",
    required: false,
  },
  {
    field: 'workNum',
    label: '工作经验',
    component:"Input",
    required: false,
  },
  {
    field: 'manageNum',
    label: '管理经验',
    component:"Input",
    required: false,
  },

  {
    field: 'industryNum',
    label: '行业经验',
    component:"Input",
    required: false,
  },
  {
    field: 'specialtyNum',
    label: '专业经验',
    component:"Input",
    required: false,
  },


];



export const teamUserColumns: VxeGridPropTypes.Columns = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '标题',
    field: 'title',
    showOverflow: 'title',
    align: 'center',
    // width: 150,
  },
  {
    title: '审批结果',
    field: 'result',
    showOverflow: 'title',
    align: 'center',
    slots:{
      default({row}) {
        let color="",text="";
        if(row.result=='agree'){
          text="同意";
          color="green";
        }else{
          text=row.result;
        }
        return h(Tag,{color},text)
      },
    },
    width: 80,
  },
  {
    title: '审批编号',
    field: 'approveNo',
    showOverflow: 'title',
    align: 'center',
    width: 150,
  },
  {
    title: '发起时间',
    field: 'addTime',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '原职位',
    field: 'original_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '转入职位',
    field: 'now_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  // {
  //   width: 120,
  //   title: '操作',
  //   align: 'center',
  //   field: '',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
  ]
